Unified: Use offsets for swift-syntax locations - #22543
Merged
Merged
Conversation
Gets rid of the `range` objects that were used previously. This results in a roughly 50% decrease in the size of the resulting JSON. The field names that store this new information ($pos, $end, $lineStarts) match the implementation used in the TypeScript extractor.
tausbn
force-pushed
the
tausbn/unified-swift-use-offsets-for-locations
branch
from
September 10, 2026 15:37
4f39db3 to
6add305
Compare
tausbn
marked this pull request as ready for review
September 10, 2026 15:49
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The compact location format is consistently implemented, documented, and covered by UTF-8 and line-ending tests.
Review tier: Balanced
Findings: None
What changed in this PR
Replaces verbose Swift syntax ranges with compact UTF-8 offsets and a shared line-start table.
Changes:
- Emits
$pos,$end, and root-level$lineStarts. - Reconstructs tree-sitter-style points in the Swift adapter.
- Updates documentation, fixtures, and location tests.
| File | Description |
|---|---|
unified/swift-syntax-rs/swift/Sources/SwiftSyntaxFFI/SwiftSyntaxFFI.swift |
Emits compact offset metadata. |
unified/swift-syntax-rs/src/lib.rs |
Tests UTF-8 offsets and line boundaries. |
unified/swift-syntax-rs/README.md |
Documents the new JSON format. |
unified/extractor/tests/swift_syntax_pipeline.rs |
Updates pipeline fixtures. |
unified/extractor/tests/fixtures/let_x.swiftsyntax.json |
Updates serialized Swift fixture. |
unified/extractor/src/languages/swift/adapter.rs |
Converts offsets into AST ranges and points. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
asgerf
previously approved these changes
Sep 10, 2026
asgerf
left a comment
Contributor
There was a problem hiding this comment.
LGTM. I've kicked off a DCA run.
…use-offsets-for-locations # Conflicts: # unified/extractor/tests/swift_syntax_pipeline.rs
Contributor
Author
|
I fixed the merge conflict by getting rid of the changes to the test we deleted elsewhere. This should not affect the DCA results. |
asgerf
approved these changes
Sep 11, 2026
Contributor
Author
|
DCA appears to be uneventful. Merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gets rid of the
rangeobjects that were used previously. This results in a roughly 50% decrease in the size of the resulting JSON.The field names that store this new information (
$pos,$end,$lineStarts) match the implementation used in the TypeScript extractor.